<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 * @version    $Id: Controller.php 2011-03-09 08:45:41Z idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 */

class Vote_Widget_ActiveVotingsController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
		$this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer();
    
		$table = Engine_Api::_()->getDbTable('challenges', 'vote');
		$params = array(
      'approved' => 1,
      'period' => 'active',
      'ipp' => 9
    );
    
		$this->view->paginator = $paginator = $table->getPaginator($params);
		if (!$paginator->getTotalItemCount()) {
      return $this->setNoRender();
		}
  }
}